package com.gc.cscott.verify;

import com.gc.cscott.domain.contest.Contest;
import com.gc.cscott.domain.contest.VerifierLocation;
import com.gc.cscott.domain.contest.numbers.TaskNumber;
import com.google.inject.Inject;

/**
 *
 * @author root
 */
abstract class AbstractOutputVerifier implements OutputVerifier {
    @Inject
    protected Contest contest;

    protected String getVerifierLocation(TaskNumber taskNumber, String expectedType) {
        VerifierLocation location = contest.getVerifierLocation(taskNumber);
        if (expectedType.equals(location.getType()) == false) {
            throw new IllegalStateException("Wrong use of verifier configuration for task "+taskNumber+", passed type: " + location.getType() + ", expected type: " + expectedType);
        }
        return location.getLocation();
    }
}
